Redux could make you happy.
Redux could make you happy.
Redux is a state management mechanism
React's original state management is passed on through props, etc.
Redux has a singleton-like object called a store that takes care of state management.
Mediator pattern in that it unifies complex interactions by placing a single intermediary
If used raw, the state is just like a global variable, but by adding restrictions to the way the state is updated, it seems to be operated safely.
Maybe I should study Redux and migrate to it, because now I'm finally getting annoyed and saying "I'm sure this component is single, so let's expose the set in the module scope".
---
This page is auto-translated from /nishio/Reduxを使うと幸せになれるかもしれない. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.